-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added Story for AddressMotionToVacateView
#14777
Conversation
(shows how to use decorators for router & redux)
|
||
const Template = () => <AddressMotionToVacateView />; | ||
|
||
export const Basic = Template.bind({}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This (setting up a template once and then basing all stories off of it) is the recommended syntax for stories in Storybook 6.x. While it isn't particularly useful in a case with only a single story, I used it here for example purposes.
title: | ||
'Queue/Motions to Vacate/Judge Address Motion to Vacate/AddressMotionToVacateView', | ||
component: AddressMotionToVacateView, | ||
decorators: [RouterDecorator, ReduxDecorator], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can specify as many decorators as you want. Each will simply wrap the next.
Code Climate has analyzed commit e3ccc16 and detected 0 issues on this pull request. View more on Code Climate. |
}; | ||
|
||
const RouterDecorator = (storyFn) => ( | ||
<StaticRouter |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a chance that using MemoryRouter
here might actually be better; StaticRouter
works fine here since we have only one story and don't use react-router
for anything other than grabbing the matched params.
appealDetails: { | ||
[appealId]: appeal, | ||
}, | ||
amaTasks: { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I kept this seed data to the bare minimum necessary to render the component in the story. This should properly contain the whole task tree.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There might be some seed data missing, I'm getting an error for the partial grant option (will upload a screenshot on the PR).
@jcq This mostly looks great! I'm getting this error when I select the partial grant option. |
(fixes issue when choosing partial grant disposition)
@leikkisa Updated with the additional seed data necessary to avoid that issue! |
Generated by 🚫 Danger |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Description
This adds a story for
AddressMotionToVacateView
component as a way to demonstrate how to use decorators to wrap stories when components depend on things likereact-router
orredux
.Acceptance Criteria
AddressMotionToVacateView
renders properly